home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / PARCHK.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  31KB  |  580 lines

  1.  
  2.     page        ,132
  3.     title  PARCHK.ASM -- Replacement for IBM-PC ROM BIOS parity error routines
  4. ;*****************************************************************************
  5. ;*
  6. ;* copyright(C) 1984    Skip Gilbrech (CIS 71445,534)
  7. ;*                      90 Lexington Ave. #10-G
  8. ;*                      New York, NY 10016
  9. ;*                      212-685-0551
  10. ;*
  11. ;* This program may be freely copied/altered for any non-commercial
  12. ;* purpose but may not be sold or used in any way as part of any
  13. ;* profit-making venture without permission of the author.
  14. ;*
  15. ;* author = skip gilbrech
  16. ;* date written = 02/19/84
  17. ;*
  18. ;* environment:
  19. ;*  system = ibm pc (dos 2.0 - but should work on any version)
  20. ;*  processor = microsoft 8086 macro assembler
  21. ;*
  22. ;* USAGE: PARCHK /R (or) /D
  23. ;* /R = Report all errors which occur
  24. ;* /D = Disable reporting after an error
  25. ;*
  26. ;* PARCHK is a resident program which replaces the ibm pc rom-bios NMI
  27. ;* (non-maskable interrupt) handler.
  28. ;*
  29. ;* It will report any memory parity errors to the operator, but will allow
  30. ;* the system to continue running.  An installation option lets you choose
  31. ;* whether or not to receive continued reports after the first error for
  32. ;* a particular channel (system memory or i/o channel).  Regardless of the
  33. ;* option chosen, however, the first error for each channel will always be
  34. ;* reported.
  35. ;* 
  36. ;* I wrote PARCHK mostly because of the frustration I felt a few days ago
  37. ;* when the message 'PARITY CHECK 2' appeared suddenly on my pc's screen.
  38. ;* I had seen the message a couple of times before, but never at a time
  39. ;* like this:  The machine contained over 3 hours of unsaved work, and I
  40. ;* knew there was not a thing I could do about it, since the parity error
  41. ;* handler in the rom-bios simply disables interrupts and issues a HLT
  42. ;* instruction to the cpu.
  43. ;*
  44. ;* I have also read a number of messages on the Compuserve IBM-PC SIG
  45. ;* which indicate that I'm not the only one to have had this experience.
  46. ;* 
  47. ;* IBM's approach in the rom-bios makes some sense.  The condition of
  48. ;* system ram is unknown following a parity error, and continued operation
  49. ;* MIGHT result in all sorts of horrible consequences, i.e., hopelessly
  50. ;* corrupted data on disk, etc.
  51. ;*
  52. ;* On my system, though, memory parity errors have been extremely rare,
  53. ;* and have probably resulted from a slight glitch on the power line,
  54. ;* static, etc.  I really have no idea what would have happened if I
  55. ;* had been able to continue operation in those cases.  However, I have
  56. ;* crashed the system often enough (most of the time probably executing
  57. ;* random data or instructions somewhere) to have some confidence that the
  58. ;* most likely, if not the only possible, outcome of a processor gone wild
  59. ;* is simply a dead machine, i.e. interrupt vectors wiped out, etc., which
  60. ;* must be powered-down and up.
  61. ;*
  62. ;* So, for me, the risks of continued operation -- at least until important
  63. ;* data in ram are saved -- seem relatively small when balanced against
  64. ;* the CERTAINTY of lost data when the rom-bios routine gets control:  If
  65. ;* data HAS been corrupted, at least there remains the chance of later
  66. ;* being able to examine and possibly fix it.
  67. ;*
  68. ;* Continued operation still DOES represent a risk, however, especially
  69. ;* if parity errors occur often, since that probably indicates a serious
  70. ;* hardware problem somewhere in the system.
  71. ;*
  72. ;* If you don't want to take that risk, please don't use this program,
  73. ;* as I can't, of course, take responsibility for any damage, real or
  74. ;* otherwise, it may cause.
  75. ;*
  76. ;* On the other hand, if PARCHK is ever responsible for saving a multi-
  77. ;* million dollar oil deal which would otherwise have fallen victim to
  78. ;* an unruly parity bit......  (suffice it to say that I would deem it
  79. ;* an honor to allow you to express your gratitude)
  80. ;* 
  81. ;* The resident part of this code, by the way, uses up a little over 1K
  82. ;* of ram.  Most of that space is taken up by routines which save the
  83. ;* current screen, write the error message, and then restore the screen.
  84. ;* I made no particular effort to make that code as compact as possible,
  85. ;* so, if space is at a premium, and/or you like doing such things, please
  86. ;* feel free to squeeze and optimize to your heart's content...  As an
  87. ;* alternative, if you don't mind junk on your screen, it would be fairly
  88. ;* easy to replace most of the error message code with a short routine which
  89. ;* uses the rom-bios 'write teletype' function to print a message, but
  90. ;* doesn't waste any memory by saving the screen.  It's probably best not
  91. ;* to use dos functions here, since a parity error can be reported at any
  92. ;* time, even with interrupts disabled and/or while in the middle of a dos
  93. ;* routine -- and pc/ms-dos is notoriously non-reentrant.
  94. ;*
  95. ;**************************************************************************
  96.     page
  97. ;**************************************************************************
  98. ;*
  99. ;*      constants
  100. ;*
  101. ;**************************************************************************
  102. ; general equates:
  103. false           equ     0
  104. true            equ     not false
  105. cr              equ     0dh     ; carriage return
  106. lf              equ     0ah     ; line feed
  107. bell            equ     7       ; ascii bell
  108. spc             equ     ' '     ; ascii space, blank
  109. tab             equ     9       ; ascii horizontal tab
  110. ; program equates:
  111. dosint          equ     21h     ; interrupt number for dos functions
  112. prt_str         equ     9       ; dos print string function
  113. get_vers        equ     30h     ; dos get version number function
  114. get_int_vec     equ     35h     ; dos 2.0 get interrupt vector function
  115. set_int_vec     equ     25h     ; dos set interrupt vector function
  116. vidint          equ     10h     ; bios video interrupt number
  117. vid_state       equ     15      ; bios - get video state
  118. read_curs_pos   equ     3       ; bios - read cursor position
  119. set_curs_pos    equ     2       ; bios - set cursor position
  120. set_curs_type   equ     1       ; bios - set cursor type
  121. write_teletype  equ     14      ; bios - write teletype to display
  122. read_ac         equ     8       ; bios - read att/char at curs. position
  123. write_ac        equ     9       ; bios - write att/char at curs. position
  124. disp_row        equ     10      ; row to display error msg
  125. disp_col        equ     25      ; col to display error msg
  126. num_lines       equ     3       ; number of text lines to display
  127. normal          equ     7       ; normal (white on black) vid. attrib.
  128. reverse_blink   equ     0f0h    ; reverse-video blinking vid. attrib.
  129. reverse         equ     70h     ; reverse-video (no blink)
  130. ; hardware specific equates:
  131. port_a          equ     60h     ; system board 8255 port a address
  132. port_b          equ     61h     ; system board 8255 port b address
  133. port_c          equ     62h     ; system board 8255 port c address
  134. par_err_mask    equ     0c0h    ; mask to test for any parity error
  135. par_ch1_mask    equ     10000000b ; mask to test for system board parity error
  136. par_ch2_mask    equ     01000000b ; mask to test for i/o channel parity error
  137. disa_ch1_mask   equ     00010000b ; mask to disable system board parity checking
  138. enab_ch1_mask   equ     11101111b ; mask to enable system board parity checking
  139. disa_ch2_mask   equ     00100000b ; mask to disable i/o channel parity checking
  140. enab_ch2_mask   equ     11011111b ; mask to enable i/o channel parity checking
  141. nmi_int_no      equ     2       ; NMI interrupt number
  142. nmi_port        equ     0a0h    ; NMI control port
  143. enable_nmi      equ     80h     ; value to output to enable NMI
  144. disable_nmi     equ     0       ; value to output to disable NMI
  145. ;**************************************************************************
  146. int_vecs        segment at 0
  147. int_vecs        ends
  148.     page
  149. ;**************************************************************************
  150. cseg    segment
  151.         assume cs:cseg,ds:cseg
  152.         org     80h                     ; for processing command line parms.
  153. cmd_ct  label   byte                    ; number of chars. in command line
  154.         org     100h